# Maintainer: Alexey Pavlov <Alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>

pkgname=doxygen
pkgver=1.8.17
pkgrel=1
pkgdesc="A documentation system for C++, C, Java, IDL and PHP"
arch=('i686' 'x86_64')
url="http://www.doxygen.org/"
options=('strip' 'staticlibs')
license=('GPL')
depends=("gcc-libs" "libsqlite" "libiconv")
makedepends=("cmake" "gcc" "flex" "python2" "libsqlite-devel" "libiconv-devel")
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/doxygen/doxygen/archive/Release_${pkgver//./_}.tar.gz
        "doxygen-segfault.patch")
#noextract=("${pkgname}-${pkgver}.tar.gz")
sha256sums=('1b5d337e4b73ef1357a88cbd06fc4c301f08f279dac0adb99e876f4d72361f4f'
            '220f5446dd2712cb043ced03cb2927596ed25a5e60150499be9213acba5b5c25')

build() {
  local extra_config=Release
  if check_option "debug" "y"; then
    extra_config=Debug
  fi

  mkdir -p build-${CHOST} && cd build-${CHOST}
  cmake \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=${extra_config} \
    -Dbuild_wizard=OFF \
    -Dbuild_search=OFF \
    -Duse_sqlite3=ON \
    -Duse_libclang=OFF \
    ../${pkgname}-Release_${pkgver//./_}
  make
}

package() {
  cd ${srcdir}/build-${CHOST}

  make DESTDIR="${pkgdir}" install
}
